//
//   Project Name:        Kratos
//   Last Modified by:    $Author:  $
//   Date:                $Date:  $
//   Revision:            $Revision: 1.3 $
//

// Project includes
#include "DEM_application.h"
#include "includes/kernel.h"
#include "includes/kratos_flags.h"
#include "containers/flags.h"
#include "geometries/point_3d.h"
#include "geometries/line_3d_2.h"
#include "geometries/line_2d_2.h"
#include "geometries/quadrilateral_3d_4.h"
#include "geometries/triangle_3d_3.h"
#include "geometries/sphere_3d_1.h"
#include "utilities/quaternion.h"
#include "custom_utilities/cluster_information.h"

#include "custom_constitutive/DEM_Dempack_CL.h"
#include "custom_constitutive/DEM_Dempack_2D_CL.h"
#include "custom_constitutive/DEM_Dempack_torque_CL.h"
#include "custom_constitutive/DEM_Dempack_dev_CL.h"
#include "custom_constitutive/dem_kdem_2d_cl.h"
#include "custom_constitutive/dem_kdem_fabric_2d_cl.h"
#include "custom_constitutive/DEM_D_Linear_Simple_Coulomb_CL.h"
#include "custom_constitutive/DEM_D_Linear_viscous_Coulomb_CL.h"
#include "custom_constitutive/DEM_D_Linear_viscous_Coulomb_2D_CL.h"
#include "custom_constitutive/DEM_D_Hertz_viscous_Coulomb_CL.h"
#include "custom_constitutive/DEM_D_Hertz_viscous_Coulomb_2D_CL.h"
#include "custom_constitutive/DEM_D_JKR_cohesive_law.h"
#include "custom_constitutive/DEM_D_Bentonite_Colloid_CL.h"
#include "custom_constitutive/DEM_D_DMT_cohesive_law.h"
#include "custom_constitutive/DEM_D_Stress_dependent_cohesive_CL.h"
#include "custom_constitutive/dem_d_linear_custom_constants_cl.h"
#include "custom_constitutive/DEM_D_Conical_damage_CL.h"
#include "custom_constitutive/DEM_D_Quadratic_CL.h"
#include "custom_constitutive/DEM_D_void_CL.h"
#include "custom_constitutive/DEM_D_Linear_classic_CL.h"
#include "custom_constitutive/DEM_KDEM_fabric_CL.h"
#include "custom_constitutive/DEM_beam_constitutive_law.h"
#include "custom_constitutive/DEM_KDEM_Rankine_CL.h"
#include "custom_constitutive/DEM_KDEM_CamClay_CL.h"
#include "custom_constitutive/DEM_ExponentialHC_CL.h"
#include "custom_constitutive/DEM_D_Hertz_viscous_Coulomb_Nestle_CL.h"
#include "custom_constitutive/DEM_compound_constitutive_law.h"
#include "custom_constitutive/DEM_compound_constitutive_law_for_PBM.h"
#include "custom_constitutive/DEM_parallel_bond_CL.h"
#include "custom_constitutive/DEM_smooth_joint_CL.h"
#include "custom_constitutive/DEM_parallel_bond_for_membrane_CL.h"
#include "custom_constitutive/DEM_parallel_bond_bilinear_damage_CL.h"
#include "custom_constitutive/DEM_parallel_bond_bilinear_damage_mixed_CL.h"
#include "custom_constitutive/DEM_rolling_friction_model.h"
#include "custom_constitutive/DEM_rolling_friction_model_constant_torque.h"
#include "custom_constitutive/DEM_rolling_friction_model_viscous_torque.h"
#include "custom_constitutive/DEM_rolling_friction_model_bounded.h"
#include "custom_constitutive/DEM_global_damping.h"
#include "custom_constitutive/DEM_global_damping_nonviscous_constantforcedir.h"
#include "custom_constitutive/DEM_global_damping_nonviscous_variableforcedir.h"
#include "custom_constitutive/DEM_global_damping_viscous.h"

#include "custom_strategies/schemes/dem_integration_scheme.h"
#include "custom_strategies/schemes/forward_euler_scheme.h"
#include "custom_strategies/schemes/symplectic_euler_scheme.h"
#include "custom_strategies/schemes/taylor_scheme.h"
#include "custom_strategies/schemes/velocity_verlet_scheme.h"
#include "custom_strategies/schemes/runge_kutta_scheme.h"
#include "custom_strategies/schemes/quaternion_integration_scheme.h"

namespace Kratos {
KRATOS_CREATE_VARIABLE(GlobalPointersVector<Element>, CONTINUUM_INI_NEIGHBOUR_ELEMENTS)
KRATOS_CREATE_VARIABLE(GlobalPointersVector<Element>, NODE_TO_NEIGH_ELEMENT_POINTER)

//constitutive law
KRATOS_CREATE_VARIABLE(std::string, DEM_DISCONTINUUM_CONSTITUTIVE_LAW_NAME)
KRATOS_CREATE_VARIABLE(std::string, DEM_CONTINUUM_CONSTITUTIVE_LAW_NAME)
KRATOS_CREATE_VARIABLE(std::string, DEM_ROLLING_FRICTION_MODEL_NAME)
KRATOS_CREATE_VARIABLE(std::string, DEM_GLOBAL_DAMPING_MODEL_NAME)
KRATOS_CREATE_VARIABLE(DEMDiscontinuumConstitutiveLaw::Pointer, DEM_DISCONTINUUM_CONSTITUTIVE_LAW_POINTER)
KRATOS_CREATE_VARIABLE(DEMContinuumConstitutiveLaw::Pointer, DEM_CONTINUUM_CONSTITUTIVE_LAW_POINTER)
KRATOS_CREATE_VARIABLE(DEMBeamConstitutiveLaw::Pointer, DEM_BEAM_CONSTITUTIVE_LAW_POINTER)
KRATOS_CREATE_VARIABLE(DEMRollingFrictionModel::Pointer, DEM_ROLLING_FRICTION_MODEL_POINTER)
KRATOS_CREATE_VARIABLE(DEMGlobalDampingModel::Pointer, DEM_GLOBAL_DAMPING_MODEL_POINTER)

//scheme
KRATOS_CREATE_VARIABLE(std::string, DEM_TRANSLATIONAL_INTEGRATION_SCHEME_NAME)
KRATOS_CREATE_VARIABLE(std::string, DEM_ROTATIONAL_INTEGRATION_SCHEME_NAME)
KRATOS_CREATE_VARIABLE(DEMIntegrationScheme::Pointer, DEM_TRANSLATIONAL_INTEGRATION_SCHEME_POINTER)
KRATOS_CREATE_VARIABLE(DEMIntegrationScheme::Pointer, DEM_ROTATIONAL_INTEGRATION_SCHEME_POINTER)

//Probability distribution
KRATOS_CREATE_VARIABLE(std::string, PROBABILITY_DISTRIBUTION)
KRATOS_CREATE_VARIABLE(std::string, EXCENTRICITY_PROBABILITY_DISTRIBUTION)

// OPTIONS AND FLAGS
KRATOS_CREATE_VARIABLE(int, FORCE_INTEGRATION_GROUP)
KRATOS_CREATE_VARIABLE(bool, IS_STICKY)
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(TABLE_NUMBER_VELOCITY) // JIG: Backward compatibility, to erase
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(TABLE_NUMBER_ANGULAR_VELOCITY) // JIG: Backward compatibility, to erase
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(TABLE_NUMBER_FORCE) // JIG: Backward compatibility, to erase
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(TABLE_NUMBER_MOMENT) // JIG: Backward compatibility, to erase
KRATOS_CREATE_VARIABLE(int, TOP)
KRATOS_CREATE_VARIABLE(int, BOTTOM)
KRATOS_CREATE_VARIABLE(int, BOUNDING_BOX_OPTION)
KRATOS_CREATE_VARIABLE(int, ROTATION_OPTION)
KRATOS_CREATE_VARIABLE(int, VIRTUAL_MASS_OPTION)
KRATOS_CREATE_VARIABLE(int, SEARCH_CONTROL)
KRATOS_CREATE_VARIABLE(bool, IS_TIME_TO_PRINT)
KRATOS_CREATE_VARIABLE(bool, IS_TIME_TO_UPDATE_CONTACT_ELEMENT)
KRATOS_CREATE_VARIABLE(double, COORDINATION_NUMBER)
KRATOS_CREATE_VARIABLE(double, CONTINUUM_SEARCH_RADIUS_AMPLIFICATION_FACTOR)
KRATOS_CREATE_VARIABLE(double, MAX_AMPLIFICATION_RATIO_OF_THE_SEARCH_RADIUS)
KRATOS_CREATE_VARIABLE(bool, LOCAL_COORDINATION_NUMBER_OPTION)
KRATOS_CREATE_VARIABLE(bool, GLOBAL_COORDINATION_NUMBER_OPTION)
KRATOS_CREATE_VARIABLE(bool, AUTOMATIC_SKIN_COMPUTATION)
KRATOS_CREATE_VARIABLE(double, SKIN_FACTOR_RADIUS)
KRATOS_CREATE_VARIABLE(int, CLEAN_INDENT_OPTION)
KRATOS_CREATE_VARIABLE(int, CLEAN_INDENT_V2_OPTION)
KRATOS_CREATE_VARIABLE(int, TRIHEDRON_OPTION)
KRATOS_CREATE_VARIABLE(int, ROLLING_FRICTION_OPTION)
KRATOS_CREATE_VARIABLE(int, GLOBAL_DAMPING_OPTION)
KRATOS_CREATE_VARIABLE(int, POISSON_EFFECT_OPTION)
KRATOS_CREATE_VARIABLE(int, SHEAR_STRAIN_PARALLEL_TO_BOND_OPTION)
KRATOS_CREATE_VARIABLE(int, NEIGH_INITIALIZED)
KRATOS_CREATE_VARIABLE(int, TRIAXIAL_TEST_OPTION)
KRATOS_CREATE_VARIABLE(int, FIX_VELOCITIES_FLAG)
KRATOS_CREATE_VARIABLE(int, COMPUTE_STRESS_TENSOR_OPTION)
KRATOS_CREATE_VARIABLE(int, DUMMY_DEBUG_INT)
KRATOS_CREATE_VARIABLE(int, PARTICLE_ID)
KRATOS_CREATE_VARIABLE(bool, CONTAINS_CLUSTERS)
KRATOS_CREATE_VARIABLE(bool, RANDOM_ORIENTATION)
KRATOS_CREATE_VARIABLE(int, LOCAL_RESOLUTION_METHOD)
KRATOS_CREATE_VARIABLE(int, COMPUTE_FEM_RESULTS_OPTION)
KRATOS_CREATE_VARIABLE(bool, BREAKABLE_CLUSTER)
KRATOS_CREATE_VARIABLE(ClusterInformation, CLUSTER_INFORMATION)
KRATOS_CREATE_VARIABLE(std::string, CLUSTER_FILE_NAME)
KRATOS_CREATE_VARIABLE(std::string, INJECTOR_ELEMENT_TYPE)
KRATOS_CREATE_VARIABLE(int, CONTINUUM_OPTION)
KRATOS_CREATE_VARIABLE(int, FLOATING_OPTION)
KRATOS_CREATE_VARIABLE(double, DEM_ENGINE_POWER)
KRATOS_CREATE_VARIABLE(double, DEM_MAX_ENGINE_FORCE)
KRATOS_CREATE_VARIABLE(double, DEM_THRESHOLD_VELOCITY)
KRATOS_CREATE_VARIABLE(double, DEM_ENGINE_PERFORMANCE)
KRATOS_CREATE_VARIABLE(double, DEM_DRAG_CONSTANT_X)
KRATOS_CREATE_VARIABLE(double, DEM_DRAG_CONSTANT_Y)
KRATOS_CREATE_VARIABLE(double, DEM_DRAG_CONSTANT_Z)
KRATOS_CREATE_VARIABLE(bool, ENERGY_CALCULATION_OPTION)
KRATOS_CREATE_VARIABLE(double, INITIAL_VELOCITY_X_VALUE)
KRATOS_CREATE_VARIABLE(double, INITIAL_VELOCITY_Y_VALUE)
KRATOS_CREATE_VARIABLE(double, INITIAL_VELOCITY_Z_VALUE)
KRATOS_CREATE_VARIABLE(double, INITIAL_ANGULAR_VELOCITY_X_VALUE)
KRATOS_CREATE_VARIABLE(double, INITIAL_ANGULAR_VELOCITY_Y_VALUE)
KRATOS_CREATE_VARIABLE(double, INITIAL_ANGULAR_VELOCITY_Z_VALUE)
KRATOS_CREATE_VARIABLE(bool, IS_GHOST)
KRATOS_CREATE_VARIABLE(int, GROUP_ID)

// *************** Continuum only BEGIN *************
KRATOS_CREATE_VARIABLE(bool, DELTA_OPTION)
KRATOS_CREATE_VARIABLE(double, SKIN_SPHERE)
KRATOS_CREATE_VARIABLE(int, PROPERTIES_ID)
KRATOS_CREATE_VARIABLE(int, CONTACT_MESH_OPTION)
KRATOS_CREATE_VARIABLE(int, BOUNDING_BOX_SERVO_LOADING_OPTION)
KRATOS_CREATE_VARIABLE(int, USE_MESH_REPAIR_OPTION)
KRATOS_CREATE_VARIABLE(double, MAX_NUMBER_OF_INTACT_BONDS_TO_CONSIDER_A_SPHERE_BROKEN)
//KRATOS_CREATE_VARIABLE(int, FAILURE_CRITERION_OPTION)
KRATOS_CREATE_VARIABLE(int, CONCRETE_TEST_OPTION)
KRATOS_CREATE_VARIABLE(int, COHESIVE_GROUP)
KRATOS_CREATE_VARIABLE(double, PARTICLE_TENSION)
KRATOS_CREATE_VARIABLE(double, PARTICLE_COHESION) //TODO: remove this one and adopt COHESION, which is valid for walls too
KRATOS_CREATE_VARIABLE(double, INITIAL_COHESION)
KRATOS_CREATE_VARIABLE(double, AMOUNT_OF_COHESION_FROM_STRESS)
KRATOS_CREATE_VARIABLE(int, IF_BOUNDARY_ELEMENT)
KRATOS_CREATE_VARIABLE(Vector, IF_BOUNDARY_FACE)
KRATOS_CREATE_VARIABLE(DenseVector<int>, PARTICLE_CONTACT_FAILURE_ID)
KRATOS_CREATE_VARIABLE(double, DEM_PRECONSOLIDATION_PRESSURE)
KRATOS_CREATE_VARIABLE(double, DEM_M_CAMCLAY_SLOPE)
// *************** Continuum only END ***************

// ********** Beam related variables BEGIN **********
KRATOS_CREATE_VARIABLE(double, CROSS_AREA)
KRATOS_CREATE_VARIABLE(double, BEAM_PARTICLES_DISTANCE)
KRATOS_CREATE_VARIABLE(double, BEAM_LENGTH)
KRATOS_CREATE_VARIABLE(double, I22) // Planar moment of inertia 22
KRATOS_CREATE_VARIABLE(double, I33) // Planar moment of inertia 33
KRATOS_CREATE_VARIABLE(double, BEAM_INERTIA_ROT_UNIT_LENGHT_X) // Moment of inertia X / (mass * beam length)
KRATOS_CREATE_VARIABLE(double, BEAM_INERTIA_ROT_UNIT_LENGHT_Y) // Moment of inertia Y / (mass * beam length)
KRATOS_CREATE_VARIABLE(double, BEAM_INERTIA_ROT_UNIT_LENGHT_Z) // Moment of inertia Z / (mass * beam length)
// **********  Beam related variables END  **********

KRATOS_CREATE_VARIABLE(std::vector<Condition*>, WALL_POINT_CONDITION_POINTERS)
typedef std::vector<array_1d<double, 3> > std_vector_of_arrays_3d;
KRATOS_CREATE_VARIABLE(std_vector_of_arrays_3d, WALL_POINT_CONDITION_ELASTIC_FORCES)
KRATOS_CREATE_VARIABLE(std_vector_of_arrays_3d, WALL_POINT_CONDITION_TOTAL_FORCES)

// MATERIAL PARAMETERS
KRATOS_CREATE_VARIABLE(std::vector<PropertiesProxy>, VECTOR_OF_PROPERTIES_PROXIES)
KRATOS_CREATE_VARIABLE(double, NODAL_MASS_COEFF)
KRATOS_CREATE_VARIABLE(double, DEM_MAGIC_FACTOR)
KRATOS_CREATE_VARIABLE(double, DEM_MAGIC_FACTOR_POISSON)
KRATOS_CREATE_VARIABLE(double, PARTICLE_MOMENT_OF_INERTIA)
KRATOS_CREATE_VARIABLE(double, ROLLING_FRICTION)
KRATOS_CREATE_VARIABLE(double, ROLLING_FRICTION_WITH_WALLS)
KRATOS_CREATE_VARIABLE(double, HISTORICAL_MIN_K)
KRATOS_CREATE_VARIABLE(double, PARTICLE_INERTIA)
KRATOS_CREATE_VARIABLE(double, PARTICLE_DENSITY)
KRATOS_CREATE_VARIABLE(double, FRICTION) //deprecated since April 6th, 2020
KRATOS_CREATE_VARIABLE(double, STATIC_FRICTION)
KRATOS_CREATE_VARIABLE(double, DYNAMIC_FRICTION)
KRATOS_CREATE_VARIABLE(double, FRICTION_DECAY)
KRATOS_CREATE_VARIABLE(double, COEFFICIENT_OF_RESTITUTION)
KRATOS_CREATE_VARIABLE(double, PARTICLE_ROTATION_DAMP_RATIO)
KRATOS_CREATE_VARIABLE(double, DAMPING_GAMMA)
KRATOS_CREATE_VARIABLE(double, K_NORMAL)
KRATOS_CREATE_VARIABLE(double, K_TANGENTIAL)
KRATOS_CREATE_VARIABLE(double, CONICAL_DAMAGE_CONTACT_RADIUS)
KRATOS_CREATE_VARIABLE(double, CONICAL_DAMAGE_MAX_STRESS)
KRATOS_CREATE_VARIABLE(double, CONICAL_DAMAGE_ALPHA)
KRATOS_CREATE_VARIABLE(double, CONICAL_DAMAGE_ALPHA_FUNCTION)
KRATOS_CREATE_VARIABLE(double, CONICAL_DAMAGE_GAMMA)
KRATOS_CREATE_VARIABLE(double, LEVEL_OF_FOULING)
KRATOS_CREATE_VARIABLE(double, EXCENTRICITY)
KRATOS_CREATE_VARIABLE(double, EXCENTRICITY_STANDARD_DEVIATION)
KRATOS_CREATE_VARIABLE(double, ROTATIONAL_MOMENT_COEFFICIENT)
KRATOS_CREATE_VARIABLE(double, POISSON_VALUE)
KRATOS_CREATE_VARIABLE(double, INTERNAL_COHESION)
KRATOS_CREATE_VARIABLE(int, FREE_BODY_MOTION)
KRATOS_CREATE_VARIABLE(bool, RIGID_BODY_OPTION)
KRATOS_CREATE_VARIABLE(double, RIGID_BODY_MASS)
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(RIGID_BODY_CENTER_OF_MASS)
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(RIGID_BODY_INERTIAS)

// *************** Continuum only BEGIN *************
KRATOS_CREATE_VARIABLE(double, SLOPE_FRACTION_N1)
KRATOS_CREATE_VARIABLE(double, SLOPE_FRACTION_N2)
KRATOS_CREATE_VARIABLE(double, SLOPE_FRACTION_N3)
KRATOS_CREATE_VARIABLE(double, SLOPE_LIMIT_COEFF_C1)
KRATOS_CREATE_VARIABLE(double, SLOPE_LIMIT_COEFF_C2)
KRATOS_CREATE_VARIABLE(double, SLOPE_LIMIT_COEFF_C3)
KRATOS_CREATE_VARIABLE(double, YOUNG_MODULUS_PLASTIC)
KRATOS_CREATE_VARIABLE(double, PLASTIC_YIELD_STRESS)
KRATOS_CREATE_VARIABLE(double, DAMAGE_FACTOR)
KRATOS_CREATE_VARIABLE(double, SHEAR_ENERGY_COEF)
KRATOS_CREATE_VARIABLE(double, DONZE_G1)
KRATOS_CREATE_VARIABLE(double, DONZE_G2)
KRATOS_CREATE_VARIABLE(double, DONZE_G3)
KRATOS_CREATE_VARIABLE(double, DONZE_MAX_DEF)
KRATOS_CREATE_VARIABLE(double, CONTACT_FAILURE)
KRATOS_CREATE_VARIABLE(double, CONTACT_SIGMA)
KRATOS_CREATE_VARIABLE(double, CONTACT_TAU)
KRATOS_CREATE_VARIABLE(double, FAILURE_CRITERION_STATE)
KRATOS_CREATE_VARIABLE(double, UNIDIMENSIONAL_DAMAGE)
KRATOS_CREATE_VARIABLE(double, CONTACT_ORIENTATION)
KRATOS_CREATE_VARIABLE(double, CONTACT_SIGMA_MIN)
KRATOS_CREATE_VARIABLE(double, TENSION_LIMIT_INCREASE_SLOPE)
KRATOS_CREATE_VARIABLE(double, CONTACT_TAU_ZERO)
KRATOS_CREATE_VARIABLE(double, CONTACT_INTERNAL_FRICC)
KRATOS_CREATE_VARIABLE(double, KDEM_STANDARD_DEVIATION_TAU_ZERO)
KRATOS_CREATE_VARIABLE(double, KDEM_STANDARD_DEVIATION_FRICTION)
KRATOS_CREATE_VARIABLE(double, PERTURBED_TAU_ZERO)
KRATOS_CREATE_VARIABLE(double, PERTURBED_INTERNAL_FRICTION)
KRATOS_CREATE_VARIABLE(double, SIGMA_3_AVERAGE)
KRATOS_CREATE_VARIABLE(double, LOOSE_MATERIAL_YOUNG_MODULUS)
KRATOS_CREATE_VARIABLE(double, BONDED_MATERIAL_YOUNG_MODULUS)
KRATOS_CREATE_VARIABLE(bool, DEBUG_PRINTING_OPTION)
KRATOS_CREATE_VARIABLE(int, DEBUG_PRINTING_ID_1)
KRATOS_CREATE_VARIABLE(int, DEBUG_PRINTING_ID_2)
KRATOS_CREATE_VARIABLE(double, FRACTURE_ENERGY)
KRATOS_CREATE_VARIABLE(double, FRACTURE_ENERGY_NORMAL)
KRATOS_CREATE_VARIABLE(double, FRACTURE_ENERGY_TANGENTIAL)
KRATOS_CREATE_VARIABLE(double, FRACTURE_ENERGY_EXPONENT)
KRATOS_CREATE_VARIABLE(double, SIGMA_SLOPE_CHANGE_THRESHOLD)
KRATOS_CREATE_VARIABLE(double, INTERNAL_FRICTION_AFTER_THRESHOLD)
KRATOS_CREATE_VARIABLE(double, SEARCH_RADIUS_INCREMENT_FOR_BONDS_CREATION)
KRATOS_CREATE_VARIABLE(bool, IS_UNBREAKABLE)
KRATOS_CREATE_VARIABLE(double, STIFFNESS_FACTOR)
KRATOS_CREATE_VARIABLE(double, BOND_YOUNG_MODULUS)
KRATOS_CREATE_VARIABLE(double, BOND_KNKS_RATIO)
KRATOS_CREATE_VARIABLE(double, BOND_SIGMA_MAX)
KRATOS_CREATE_VARIABLE(double, BOND_SIGMA_MAX_DEVIATION)
KRATOS_CREATE_VARIABLE(double, BOND_TAU_ZERO)
KRATOS_CREATE_VARIABLE(double, BOND_TAU_ZERO_DEVIATION)
KRATOS_CREATE_VARIABLE(double, BOND_INTERNAL_FRICC)
KRATOS_CREATE_VARIABLE(double, BOND_ROTATIONAL_MOMENT_COEFFICIENT_NORMAL)
KRATOS_CREATE_VARIABLE(double, BOND_ROTATIONAL_MOMENT_COEFFICIENT_TANGENTIAL)
KRATOS_CREATE_VARIABLE(double, BOND_RADIUS_FACTOR)
KRATOS_CREATE_VARIABLE(double, JOINT_NORMAL_STIFFNESS)
KRATOS_CREATE_VARIABLE(double, JOINT_TANGENTIAL_STIFFNESS)
KRATOS_CREATE_VARIABLE(double, JOINT_NORMAL_DIRECTION_X)
KRATOS_CREATE_VARIABLE(double, JOINT_NORMAL_DIRECTION_Y)
KRATOS_CREATE_VARIABLE(double, JOINT_NORMAL_DIRECTION_Z)
KRATOS_CREATE_VARIABLE(double, JOINT_FRICTION_COEFF)
KRATOS_CREATE_VARIABLE(double, K_ALPHA) // for DEM_D_Quadratic_LAW
// *************** Continuum only END *************

// GEOMETRIC PARAMETERS
// *************** Continuum only BEGIN *************
KRATOS_CREATE_VARIABLE(double, LOCAL_CONTACT_AREA_HIGH)
KRATOS_CREATE_VARIABLE(double, LOCAL_CONTACT_AREA_LOW)
KRATOS_CREATE_VARIABLE(double, MEAN_CONTACT_AREA)
KRATOS_CREATE_VARIABLE(double, CONTACT_RADIUS)
KRATOS_CREATE_VARIABLE(double, REPRESENTATIVE_VOLUME)
KRATOS_CREATE_VARIABLE(DenseVector<int>, NEIGHBOUR_IDS)
KRATOS_CREATE_VARIABLE(DenseVector<double>, NEIGHBOURS_CONTACT_AREAS)
// *************** Continuum only END ***************

//INLET PARAMETERS
KRATOS_CREATE_VARIABLE(double, INLET_START_TIME)
KRATOS_CREATE_VARIABLE(double, INLET_STOP_TIME)
KRATOS_CREATE_VARIABLE(double, INLET_NUMBER_OF_PARTICLES)
KRATOS_CREATE_VARIABLE(double, STANDARD_DEVIATION)
KRATOS_CREATE_VARIABLE(double, DEVIATION)
KRATOS_CREATE_VARIABLE(double, MAX_RAND_DEVIATION_ANGLE)
KRATOS_CREATE_VARIABLE(bool, IMPOSED_MASS_FLOW_OPTION)
KRATOS_CREATE_VARIABLE(double, MASS_FLOW)
KRATOS_CREATE_VARIABLE(double, MAXIMUM_RADIUS)
KRATOS_CREATE_VARIABLE(double, MINIMUM_RADIUS)
KRATOS_CREATE_VARIABLE(double, INITIAL_RADIUS)
KRATOS_CREATE_VARIABLE(bool, DENSE_INLET)
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(LINEAR_VELOCITY)
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(INLET_INITIAL_VELOCITY)
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(INLET_INITIAL_PARTICLES_VELOCITY)
KRATOS_CREATE_VARIABLE(double, INLET_MAX_PARTICLES_VELOCITY)

// KINEMATICS
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(PARTICLE_ROTATION_ANGLE)
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(EULER_ANGLES)
KRATOS_CREATE_VARIABLE(bool, DOMAIN_IS_PERIODIC)
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(DOMAIN_MIN_CORNER)
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(DOMAIN_MAX_CORNER)
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(DELTA_DISPLACEMENT)
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(DELTA_ROTA_DISPLACEMENT)
KRATOS_CREATE_VARIABLE(double, VELOCITY_START_TIME)
KRATOS_CREATE_VARIABLE(double, VELOCITY_STOP_TIME)
KRATOS_CREATE_VARIABLE(double, ANGULAR_VELOCITY_START_TIME)
KRATOS_CREATE_VARIABLE(double, ANGULAR_VELOCITY_STOP_TIME)
KRATOS_CREATE_VARIABLE(int, RIGID_BODY_MOTION)

// ****************** Quaternion Integration BEGIN ******************
KRATOS_CREATE_VARIABLE(Quaternion<double>, AUX_ORIENTATION)
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(LOCAL_AUX_ANGULAR_VELOCITY)
// ******************* Quaternion Integration END *******************

// ****************Radius expansion method BEGIN*******************
KRATOS_CREATE_VARIABLE(bool, IS_RADIUS_EXPANSION)
KRATOS_CREATE_VARIABLE(double, RADIUS_EXPANSION_RATE)
KRATOS_CREATE_VARIABLE(double, RADIUS_MULTIPLIER_START_TIME)
KRATOS_CREATE_VARIABLE(double, RADIUS_MULTIPLIER_MAX)
KRATOS_CREATE_VARIABLE(bool, IS_RADIUS_EXPANSION_RATE_CHANGE)
KRATOS_CREATE_VARIABLE(double, RADIUS_EXPANSION_ACCELERATION)
KRATOS_CREATE_VARIABLE(double, RADIUS_EXPANSION_RATE_MIN)
// *****************Radius expansion method END********************

// FORCE AND MOMENTUM
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(CONTACT_IMPULSE)
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(PARTICLE_MOMENT)
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(ROLLING_RESISTANCE_MOMENT)
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(MAX_ROTA_MOMENT)
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(ELASTIC_FORCES)
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(CONTACT_FORCES)
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(RIGID_ELEMENT_FORCE)
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(TANGENTIAL_ELASTIC_FORCES)
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(FORCE_REACTION)
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(MOMENT_REACTION)
KRATOS_CREATE_VARIABLE(double, DEM_PRESSURE)
KRATOS_CREATE_VARIABLE(double, DEM_NODAL_AREA)

// ENERGY
KRATOS_CREATE_VARIABLE(double, PARTICLE_ELASTIC_ENERGY)
KRATOS_CREATE_VARIABLE(double, PARTICLE_TRANSLATIONAL_KINEMATIC_ENERGY)
KRATOS_CREATE_VARIABLE(double, PARTICLE_ROTATIONAL_KINEMATIC_ENERGY)
KRATOS_CREATE_VARIABLE(double, PARTICLE_GRAVITATIONAL_ENERGY)
KRATOS_CREATE_VARIABLE(double, PARTICLE_INELASTIC_VISCODAMPING_ENERGY)
KRATOS_CREATE_VARIABLE(double, PARTICLE_INELASTIC_FRICTIONAL_ENERGY)
KRATOS_CREATE_VARIABLE(double, PARTICLE_INELASTIC_ROLLING_RESISTANCE_ENERGY)
KRATOS_CREATE_VARIABLE(double, PARTICLE_MAX_NORMAL_BALL_TO_BALL_FORCE_TIMES_RADIUS)
KRATOS_CREATE_VARIABLE(int, COMPUTE_ENERGY_OPTION)
KRATOS_CREATE_VARIABLE(double, GLOBAL_DAMPING)
KRATOS_CREATE_VARIABLE(double, NORMAL_IMPACT_VELOCITY)
KRATOS_CREATE_VARIABLE(double, TANGENTIAL_IMPACT_VELOCITY)
KRATOS_CREATE_VARIABLE(double, FACE_NORMAL_IMPACT_VELOCITY)
KRATOS_CREATE_VARIABLE(double, FACE_TANGENTIAL_IMPACT_VELOCITY)
KRATOS_CREATE_VARIABLE(double, LINEAR_IMPULSE)

// *************** Continuum only BEGIN *************
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(INITIAL_ROTA_MOMENT)
KRATOS_CREATE_VARIABLE(Vector, PARTICLE_BLOCK_CONTACT_FORCE)
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(LOCAL_CONTACT_FORCE)
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(GLOBAL_CONTACT_FORCE)
KRATOS_CREATE_VARIABLE(VectorArray3Double, PARTICLE_CONTACT_FORCES)
KRATOS_CREATE_VARIABLE(double, NEIGHBOUR_SIZE)
KRATOS_CREATE_VARIABLE(double, DAMAGE_RATIO)

// CONCRETE TEST
KRATOS_CREATE_VARIABLE(double, FIXED_VEL_TOP)
KRATOS_CREATE_VARIABLE(double, FIXED_VEL_BOT)
KRATOS_CREATE_VARIABLE(double, AREA_VERTICAL_TAPA)
KRATOS_CREATE_VARIABLE(double, AREA_VERTICAL_CENTRE)

// TENSION
KRATOS_CREATE_VARIABLE(Matrix, DEM_STRESS_TENSOR)
KRATOS_CREATE_VARIABLE(Matrix, DEM_STRESS_TENSOR_RAW)
KRATOS_CREATE_VARIABLE(Matrix, DEM_STRAIN_TENSOR)
KRATOS_CREATE_VARIABLE(Matrix, DEM_DIFFERENTIAL_STRAIN_TENSOR)

// APPLIED LOADS
KRATOS_CREATE_VARIABLE(double, BLAST_RADIUS)
KRATOS_CREATE_VARIABLE(int, BLAST_CURVE)
KRATOS_CREATE_VARIABLE(double, BLAST_PRESSURE_MAX)
KRATOS_CREATE_VARIABLE(double, BLAST_TIME_PRESSURE_MAX)
KRATOS_CREATE_VARIABLE(double, BLAST_SHAPE_FACTOR)
KRATOS_CREATE_VARIABLE(double, BLAST_TIME_DELAY)
KRATOS_CREATE_VARIABLE(int, BLAST_BOREHOLE)
KRATOS_CREATE_VARIABLE(int, BLAST_NPOINTS)
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(BLAST_COORDINATES_1)
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(BLAST_COORDINATES_2)
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(BLAST_COORDINATES_3)
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(BLAST_COORDINATES_4)
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(BLAST_COORDINATES_5)
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(BLAST_COORDINATES_6)
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(BLAST_COORDINATES_7)
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(BLAST_COORDINATES_8)
// *************** Continuum only END *************

// Possible future blocks (no FEM) interaction
KRATOS_CREATE_VARIABLE(Vector, PARTICLE_BLOCK_CONTACT_FAILURE_ID)
KRATOS_CREATE_VARIABLE(Vector, PARTICLE_BLOCK_IF_INITIAL_CONTACT)
KRATOS_CREATE_VARIABLE(GlobalPointersVector<Element>, NEIGHBOUR_PARTICLE_BLOCK_ELEMENTS)
KRATOS_CREATE_VARIABLE(GlobalPointersVector<Condition>, NEIGHBOUR_RIGID_FACES)
KRATOS_CREATE_VARIABLE(Vector, NEIGHBOUR_RIGID_FACES_PRAM)
KRATOS_CREATE_VARIABLE(GlobalPointersVector<Element>, NEIGHBOUR_PARTICLE_OF_RIGID_FACE)
KRATOS_CREATE_VARIABLE(Vector, NEIGHBOUR_RIGID_FACES_ELASTIC_CONTACT_FORCE)
KRATOS_CREATE_VARIABLE(Vector, NEIGHBOUR_RIGID_FACES_TOTAL_CONTACT_FORCE)

// DUMMY INT AND DOUBLE VARIABLES
KRATOS_CREATE_VARIABLE(int, DUMMY_SWITCH)
KRATOS_CREATE_VARIABLE(double, TOTAL_CONTACT_DISTANCES)

// EXPORTS
KRATOS_CREATE_VARIABLE(double, EXPORT_PARTICLE_FAILURE_ID)
KRATOS_CREATE_VARIABLE(double, EXPORT_ID)
KRATOS_CREATE_VARIABLE(int, PRINT_EXPORT_ID)
KRATOS_CREATE_VARIABLE(int, PRINT_STRESS_TENSOR_OPTION)

// For DEM_FEM element
KRATOS_CREATE_VARIABLE(double, LOCAL_DAMP_RATIO)
// For DEM_FEM condition
// KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS( FORCE_RESIDUAL )
// KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS( EXTERNAL_FORCE )

// DUMMY VARIABLES FOR CALCULATE
KRATOS_CREATE_VARIABLE(double, CALCULATE_COMPUTE_NEW_NEIGHBOURS_HISTORICAL_DATA)
KRATOS_CREATE_VARIABLE(double, CALCULATE_COMPUTE_NEW_RIGID_FACE_NEIGHBOURS_HISTORICAL_DATA)
KRATOS_CREATE_VARIABLE(double, CALCULATE_SET_INITIAL_DEM_CONTACTS)
KRATOS_CREATE_VARIABLE(double, CALCULATE_SET_INITIAL_FEM_CONTACTS)

// Cfeng,131013,RigidFace Movement
KRATOS_CREATE_VARIABLE(double, RIGID_FACE_ROTA_SPEED)
KRATOS_CREATE_VARIABLE(double, RIGID_FACE_AXIAL_SPEED)
KRATOS_CREATE_VARIABLE(int, RIGID_FACE_PROP_ID)
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(RIGID_FACE_ROTA_ORIGIN_COORD)
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(RIGID_FACE_ROTA_AXIAL_DIR)
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(RIGID_FACE_ROTA_GLOBAL_VELOCITY)
KRATOS_CREATE_VARIABLE(double, RIGID_FACE_BEGIN_TIME)
KRATOS_CREATE_VARIABLE(double, RIGID_FACE_END_TIME)
KRATOS_CREATE_VARIABLE(int, RIGID_FACE_FLAG)
KRATOS_CREATE_VARIABLE(Vector, RIGID_FACE_COMPUTE_MOVEMENT)

//SLS DEM-FEM
KRATOS_CREATE_VARIABLE(double, SHEAR_STRESS)
KRATOS_CREATE_VARIABLE(double, NON_DIMENSIONAL_VOLUME_WEAR)
KRATOS_CREATE_VARIABLE(double, IMPACT_WEAR)
KRATOS_CREATE_VARIABLE(double, SEVERITY_OF_WEAR)
KRATOS_CREATE_VARIABLE(double, BRINELL_HARDNESS)
KRATOS_CREATE_VARIABLE(bool, COMPUTE_WEAR)
KRATOS_CREATE_VARIABLE(double, IMPACT_WEAR_SEVERITY)
KRATOS_CREATE_VARIABLE(double, WALL_COHESION)

//DEM_CLUSTERS
KRATOS_CREATE_VARIABLE(double, CLUSTER_VOLUME)
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(PRINCIPAL_MOMENTS_OF_INERTIA)
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(LOCAL_ANGULAR_VELOCITY)
KRATOS_CREATE_VARIABLE(double, CHARACTERISTIC_LENGTH)
KRATOS_CREATE_VARIABLE(double, SPRAYED_MATERIAL)

//BOUNDING BOX
KRATOS_CREATE_VARIABLE(double, BOUNDING_BOX_START_TIME)
KRATOS_CREATE_VARIABLE(double, BOUNDING_BOX_STOP_TIME)

//CONTROL MODULE
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(TARGET_STRESS)
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(REACTION_STRESS)
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(SMOOTHED_REACTION_STRESS)
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(ELASTIC_REACTION_STRESS)
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(SMOOTHED_ELASTIC_REACTION_STRESS)
KRATOS_CREATE_3D_VARIABLE_WITH_COMPONENTS(LOADING_VELOCITY)
KRATOS_CREATE_VARIABLE(double, RADIAL_NORMAL_STRESS_COMPONENT)
KRATOS_CREATE_VARIABLE(double, OLD_RADIAL_NORMAL_STRESS_COMPONENT)
KRATOS_CREATE_VARIABLE(double, SMOOTHED_SCALAR_RADIAL_VELOCITY)

// for DEM-FEM 2D
KRATOS_CREATE_VARIABLE(double, IMPOSED_Z_STRAIN_VALUE)
KRATOS_CREATE_VARIABLE(bool, IMPOSED_Z_STRAIN_OPTION)

// RVE analysis
KRATOS_CREATE_VARIABLE(bool, RVE_ANALYSIS)

//FLAGS
KRATOS_CREATE_LOCAL_FLAG(DEMFlags, HAS_ROTATION, 0);
KRATOS_CREATE_LOCAL_FLAG(DEMFlags, HAS_ROLLING_FRICTION, 1);
KRATOS_CREATE_LOCAL_FLAG(DEMFlags, HAS_GLOBAL_DAMPING, 2);
KRATOS_CREATE_LOCAL_FLAG(DEMFlags, STICKY, 3);
KRATOS_CREATE_LOCAL_FLAG(DEMFlags, HAS_CRITICAL_TIME, 4);
KRATOS_CREATE_LOCAL_FLAG(DEMFlags, FIXED_VEL_X, 5);
KRATOS_CREATE_LOCAL_FLAG(DEMFlags, FIXED_VEL_Y, 6);
KRATOS_CREATE_LOCAL_FLAG(DEMFlags, FIXED_VEL_Z, 7);
KRATOS_CREATE_LOCAL_FLAG(DEMFlags, FIXED_ANG_VEL_X, 8);
KRATOS_CREATE_LOCAL_FLAG(DEMFlags, FIXED_ANG_VEL_Y, 9);
KRATOS_CREATE_LOCAL_FLAG(DEMFlags, FIXED_ANG_VEL_Z, 10);
KRATOS_CREATE_LOCAL_FLAG(DEMFlags, BELONGS_TO_A_CLUSTER, 11);
KRATOS_CREATE_LOCAL_FLAG(DEMFlags, HAS_STRESS_TENSOR, 12);
KRATOS_CREATE_LOCAL_FLAG(DEMFlags, COPIED_STRESS_TENSOR, 13);
KRATOS_CREATE_LOCAL_FLAG(DEMFlags, COPIED_STRESS_TENSOR2, 14);
KRATOS_CREATE_LOCAL_FLAG(DEMFlags, PRINT_STRESS_TENSOR, 15);
KRATOS_CREATE_LOCAL_FLAG(DEMFlags, CUMULATIVE_ZONE, 16);
KRATOS_CREATE_LOCAL_FLAG(DEMFlags, IS_SAND_PRODUCTION, 17);
KRATOS_CREATE_LOCAL_FLAG(DEMFlags, POLYHEDRON_SKIN, 18);

//ELEMENTS
KratosDEMApplication::KratosDEMApplication() : KratosApplication("DEMApplication"),
    mCylinderParticle2D(0, Element::GeometryType::Pointer(new Sphere3D1<Node >(Element::GeometryType::PointsArrayType(1)))),
    mCylinderContinuumParticle2D(0, Element::GeometryType::Pointer(new Sphere3D1<Node >(Element::GeometryType::PointsArrayType(1)))),
    mSphericParticle3D(0, Element::GeometryType::Pointer(new Sphere3D1<Node >(Element::GeometryType::PointsArrayType(1)))),
    mNanoParticle3D(0, Element::GeometryType::Pointer(new Sphere3D1<Node >(Element::GeometryType::PointsArrayType(1)))),
    mAnalyticSphericParticle3D(0, Element::GeometryType::Pointer(new Sphere3D1<Node >(Element::GeometryType::PointsArrayType(1)))),
    mSphericContinuumParticle3D(0, Element::GeometryType::Pointer(new Sphere3D1<Node >(Element::GeometryType::PointsArrayType(1)))),
    mPolyhedronSkinSphericParticle3D(0, Element::GeometryType::Pointer(new Sphere3D1<Node >(Element::GeometryType::PointsArrayType(1)))),
    mIceContinuumParticle3D(0, Element::GeometryType::Pointer(new Sphere3D1<Node >(Element::GeometryType::PointsArrayType(1)))),
    mBeamParticle3D(0, Element::GeometryType::Pointer(new Sphere3D1<Node >(Element::GeometryType::PointsArrayType(1)))),
    mBondingSphericContinuumParticle3D(0, Element::GeometryType::Pointer(new Sphere3D1<Node >(Element::GeometryType::PointsArrayType(1)))),
    mParticleContactElement(0, Element::GeometryType::Pointer(new Line3D2<Node >(Element::GeometryType::PointsArrayType(2)))),
    mSolidFace3D3N(0, Element::GeometryType::Pointer(new Triangle3D3<Node >(Element::GeometryType::PointsArrayType(3)))),
    mSolidFace3D4N(0, Element::GeometryType::Pointer(new Quadrilateral3D4<Node >(Element::GeometryType::PointsArrayType(4)))),
    mRigidFace3D2N(0, Element::GeometryType::Pointer(new Line3D2<Node >(Element::GeometryType::PointsArrayType(2)))),
    mRigidFace3D3N(0, Element::GeometryType::Pointer(new Triangle3D3<Node >(Element::GeometryType::PointsArrayType(3)))),
    mRigidFace3D4N(0, Element::GeometryType::Pointer(new Quadrilateral3D4<Node >(Element::GeometryType::PointsArrayType(4)))),
    mRigidFace3D1N(0, Element::GeometryType::Pointer(new Point3D<Node >(Element::GeometryType::PointsArrayType(1)))),
    mAnalyticRigidFace3D3N(0, Element::GeometryType::Pointer(new Triangle3D3<Node >(Element::GeometryType::PointsArrayType(3)))),
    mRigidEdge2D2N(0, Element::GeometryType::Pointer(new Line2D2<Node >(Element::GeometryType::PointsArrayType(2)))),
    mRigidEdge2D1N(0, Element::GeometryType::Pointer(new Point2D<Node >(Element::GeometryType::PointsArrayType(1)))),
    mRigidBodyElement3D(0, Element::GeometryType::Pointer(new Point3D<Node >(Element::GeometryType::PointsArrayType(1)))),
    mShipElement3D(0, Element::GeometryType::Pointer(new Point3D<Node >(Element::GeometryType::PointsArrayType(1)))),
    mContactInfoSphericParticle3D(0, Element::GeometryType::Pointer(new Sphere3D1<Node >(Element::GeometryType::PointsArrayType(1)))),
    mCluster3D(0, Element::GeometryType::Pointer(new Sphere3D1<Node >(Element::GeometryType::PointsArrayType(1)))),
    mSingleSphereCluster3D(0, Element::GeometryType::Pointer(new Sphere3D1<Node >(Element::GeometryType::PointsArrayType(1)))),
    mMapCon3D3N(0, Element::GeometryType::Pointer(new Triangle3D3<Node >(Element::GeometryType::PointsArrayType(3)))) {}

// Explicit instantiation of composed constitutive laws
template class DEM_compound_constitutive_law<DEM_D_Hertz_viscous_Coulomb, DEM_D_JKR_Cohesive_Law>;
template class DEM_compound_constitutive_law<DEM_D_Hertz_viscous_Coulomb, DEM_D_DMT_Cohesive_Law>;
template class DEM_compound_constitutive_law<DEM_D_Linear_viscous_Coulomb, DEM_D_JKR_Cohesive_Law>;
template class DEM_compound_constitutive_law<DEM_D_Linear_viscous_Coulomb, DEM_D_DMT_Cohesive_Law>;

// for parallel bond model
template class DEM_compound_constitutive_law_for_PBM<DEM_parallel_bond, DEM_D_Hertz_viscous_Coulomb>;
template class DEM_compound_constitutive_law_for_PBM<DEM_parallel_bond, DEM_D_Linear_classic>;
template class DEM_compound_constitutive_law_for_PBM<DEM_parallel_bond, DEM_D_Quadratic>;

template class DEM_compound_constitutive_law_for_PBM<DEM_parallel_bond_bilinear_damage, DEM_D_Hertz_viscous_Coulomb>;
template class DEM_compound_constitutive_law_for_PBM<DEM_parallel_bond_bilinear_damage, DEM_D_Linear_classic>;
template class DEM_compound_constitutive_law_for_PBM<DEM_parallel_bond_bilinear_damage, DEM_D_Quadratic>;

template class DEM_compound_constitutive_law_for_PBM<DEM_parallel_bond_bilinear_damage_mixed, DEM_D_Hertz_viscous_Coulomb>;
template class DEM_compound_constitutive_law_for_PBM<DEM_parallel_bond_bilinear_damage_mixed, DEM_D_Linear_classic>;
template class DEM_compound_constitutive_law_for_PBM<DEM_parallel_bond_bilinear_damage_mixed, DEM_D_Quadratic>;

void KratosDEMApplication::Register() {
    KRATOS_INFO("") << "\n"
                    << "     KRATOS |  _ \\| ____|  \\/  |  _ \\ __ _  ___| | __      \n"
                    << "            | | | |  _| | |\\/| | |_) / _` |/ __| |/ /      \n"
                    << "            | |_| | |___| |  | |  __/ (_| | (__|   <       \n"
                    << "            |____/|_____|_|  |_|_|   \\__,_|\\___|_|\\_\\      \n"
                    << "Importing DEMApplication... ";

    KRATOS_REGISTER_VARIABLE(CONTINUUM_INI_NEIGHBOUR_ELEMENTS)
    KRATOS_REGISTER_VARIABLE(NODE_TO_NEIGH_ELEMENT_POINTER)

    //constitutive law
    KRATOS_REGISTER_VARIABLE(DEM_DISCONTINUUM_CONSTITUTIVE_LAW_NAME)
    KRATOS_REGISTER_VARIABLE(DEM_CONTINUUM_CONSTITUTIVE_LAW_NAME)
    KRATOS_REGISTER_VARIABLE(DEM_ROLLING_FRICTION_MODEL_NAME)
    KRATOS_REGISTER_VARIABLE(DEM_GLOBAL_DAMPING_MODEL_NAME)
    KRATOS_REGISTER_VARIABLE(DEM_DISCONTINUUM_CONSTITUTIVE_LAW_POINTER)
    KRATOS_REGISTER_VARIABLE(DEM_CONTINUUM_CONSTITUTIVE_LAW_POINTER)
    KRATOS_REGISTER_VARIABLE(DEM_BEAM_CONSTITUTIVE_LAW_POINTER)
    KRATOS_REGISTER_VARIABLE(DEM_ROLLING_FRICTION_MODEL_POINTER)
    KRATOS_REGISTER_VARIABLE(DEM_GLOBAL_DAMPING_MODEL_POINTER)

    //scheme
    KRATOS_REGISTER_VARIABLE(DEM_TRANSLATIONAL_INTEGRATION_SCHEME_NAME)
    KRATOS_REGISTER_VARIABLE(DEM_ROTATIONAL_INTEGRATION_SCHEME_NAME)
    KRATOS_REGISTER_VARIABLE(DEM_TRANSLATIONAL_INTEGRATION_SCHEME_POINTER)
    KRATOS_REGISTER_VARIABLE(DEM_ROTATIONAL_INTEGRATION_SCHEME_POINTER)

    KRATOS_REGISTER_VARIABLE(PROBABILITY_DISTRIBUTION)
    KRATOS_REGISTER_VARIABLE(EXCENTRICITY_PROBABILITY_DISTRIBUTION)

    // OPTIONS AND FLAGS
    KRATOS_REGISTER_VARIABLE(TOP)
    KRATOS_REGISTER_VARIABLE(BOTTOM)
    KRATOS_REGISTER_VARIABLE(FORCE_INTEGRATION_GROUP)
    KRATOS_REGISTER_VARIABLE(IS_STICKY)
    KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(TABLE_NUMBER_VELOCITY) // JIG: Backward compatibility, to erase
    KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(TABLE_NUMBER_ANGULAR_VELOCITY) // JIG: Backward compatibility, to erase
    KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(TABLE_NUMBER_FORCE) // JIG: Backward compatibility, to erase
    KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(TABLE_NUMBER_MOMENT) // JIG: Backward compatibility, to erase
    KRATOS_REGISTER_VARIABLE(SHEAR_STRAIN_PARALLEL_TO_BOND_OPTION)
    KRATOS_REGISTER_VARIABLE(POISSON_EFFECT_OPTION)
    KRATOS_REGISTER_VARIABLE(ROLLING_FRICTION_OPTION)
    KRATOS_REGISTER_VARIABLE(GLOBAL_DAMPING_OPTION)
    KRATOS_REGISTER_VARIABLE(BOUNDING_BOX_OPTION)
    KRATOS_REGISTER_VARIABLE(ROTATION_OPTION)
    KRATOS_REGISTER_VARIABLE(VIRTUAL_MASS_OPTION)
    KRATOS_REGISTER_VARIABLE(SEARCH_CONTROL)
    KRATOS_REGISTER_VARIABLE(IS_TIME_TO_PRINT)
    KRATOS_REGISTER_VARIABLE(IS_TIME_TO_UPDATE_CONTACT_ELEMENT)
    KRATOS_REGISTER_VARIABLE(COORDINATION_NUMBER)
    KRATOS_REGISTER_VARIABLE(CONTINUUM_SEARCH_RADIUS_AMPLIFICATION_FACTOR)
    KRATOS_REGISTER_VARIABLE(MAX_AMPLIFICATION_RATIO_OF_THE_SEARCH_RADIUS)
    KRATOS_REGISTER_VARIABLE(LOCAL_COORDINATION_NUMBER_OPTION)
    KRATOS_REGISTER_VARIABLE(GLOBAL_COORDINATION_NUMBER_OPTION)
    KRATOS_REGISTER_VARIABLE(AUTOMATIC_SKIN_COMPUTATION)
    KRATOS_REGISTER_VARIABLE(SKIN_FACTOR_RADIUS)
    KRATOS_REGISTER_VARIABLE(CLEAN_INDENT_OPTION)
    KRATOS_REGISTER_VARIABLE(CLEAN_INDENT_V2_OPTION)
    KRATOS_REGISTER_VARIABLE(TRIHEDRON_OPTION)
    KRATOS_REGISTER_VARIABLE(NEIGH_INITIALIZED)
    KRATOS_REGISTER_VARIABLE(TRIAXIAL_TEST_OPTION)
    KRATOS_REGISTER_VARIABLE(FIX_VELOCITIES_FLAG)
    KRATOS_REGISTER_VARIABLE(COMPUTE_STRESS_TENSOR_OPTION)
    KRATOS_REGISTER_VARIABLE(PARTICLE_ID)
    KRATOS_REGISTER_VARIABLE(CONTAINS_CLUSTERS)
    KRATOS_REGISTER_VARIABLE(RANDOM_ORIENTATION)
    KRATOS_REGISTER_VARIABLE(LOCAL_RESOLUTION_METHOD)
    KRATOS_REGISTER_VARIABLE(COMPUTE_FEM_RESULTS_OPTION)
    KRATOS_REGISTER_VARIABLE(BREAKABLE_CLUSTER)
    KRATOS_REGISTER_VARIABLE(CLUSTER_INFORMATION)
    KRATOS_REGISTER_VARIABLE(CLUSTER_FILE_NAME)
    KRATOS_REGISTER_VARIABLE(INJECTOR_ELEMENT_TYPE)
    KRATOS_REGISTER_VARIABLE(CONTINUUM_OPTION)
    KRATOS_REGISTER_VARIABLE(FLOATING_OPTION)
    KRATOS_REGISTER_VARIABLE(DEM_ENGINE_POWER)
    KRATOS_REGISTER_VARIABLE(DEM_MAX_ENGINE_FORCE)
    KRATOS_REGISTER_VARIABLE(DEM_THRESHOLD_VELOCITY)
    KRATOS_REGISTER_VARIABLE(DEM_ENGINE_PERFORMANCE)
    KRATOS_REGISTER_VARIABLE(DEM_DRAG_CONSTANT_X)
    KRATOS_REGISTER_VARIABLE(DEM_DRAG_CONSTANT_Y)
    KRATOS_REGISTER_VARIABLE(DEM_DRAG_CONSTANT_Z)
    KRATOS_REGISTER_VARIABLE(ENERGY_CALCULATION_OPTION)
    KRATOS_REGISTER_VARIABLE(INITIAL_VELOCITY_X_VALUE)
    KRATOS_REGISTER_VARIABLE(INITIAL_VELOCITY_Y_VALUE)
    KRATOS_REGISTER_VARIABLE(INITIAL_VELOCITY_Z_VALUE)
    KRATOS_REGISTER_VARIABLE(INITIAL_ANGULAR_VELOCITY_X_VALUE)
    KRATOS_REGISTER_VARIABLE(INITIAL_ANGULAR_VELOCITY_Y_VALUE)
    KRATOS_REGISTER_VARIABLE(INITIAL_ANGULAR_VELOCITY_Z_VALUE)
    KRATOS_REGISTER_VARIABLE(IS_GHOST)
    KRATOS_REGISTER_VARIABLE(GROUP_ID)

    // *************** Continuum only BEGIN *************
    KRATOS_REGISTER_VARIABLE(DELTA_OPTION)
    KRATOS_REGISTER_VARIABLE(SKIN_SPHERE)
    KRATOS_REGISTER_VARIABLE(PROPERTIES_ID)
    KRATOS_REGISTER_VARIABLE(CONTACT_MESH_OPTION)
    KRATOS_REGISTER_VARIABLE(BOUNDING_BOX_SERVO_LOADING_OPTION)
    KRATOS_REGISTER_VARIABLE(USE_MESH_REPAIR_OPTION)
    KRATOS_REGISTER_VARIABLE(MAX_NUMBER_OF_INTACT_BONDS_TO_CONSIDER_A_SPHERE_BROKEN)
    //KRATOS_REGISTER_VARIABLE(FAILURE_CRITERION_OPTION)
    KRATOS_REGISTER_VARIABLE(CONCRETE_TEST_OPTION)
    KRATOS_REGISTER_VARIABLE(COHESIVE_GROUP)
    KRATOS_REGISTER_VARIABLE(PARTICLE_TENSION)
    KRATOS_REGISTER_VARIABLE(PARTICLE_COHESION)
    KRATOS_REGISTER_VARIABLE(INITIAL_COHESION)
    KRATOS_REGISTER_VARIABLE(AMOUNT_OF_COHESION_FROM_STRESS)
    KRATOS_REGISTER_VARIABLE(IF_BOUNDARY_ELEMENT)
    KRATOS_REGISTER_VARIABLE(IF_BOUNDARY_FACE)
    KRATOS_REGISTER_VARIABLE(PARTICLE_CONTACT_FAILURE_ID)
    KRATOS_REGISTER_VARIABLE(EXPORT_PARTICLE_FAILURE_ID)
    KRATOS_REGISTER_VARIABLE(DEM_PRECONSOLIDATION_PRESSURE)
    KRATOS_REGISTER_VARIABLE(DEM_M_CAMCLAY_SLOPE)
    // *************** Continuum only END ***************

    // ********** Beam related variables BEGIN **********
    KRATOS_REGISTER_VARIABLE(CROSS_AREA)
    KRATOS_REGISTER_VARIABLE(BEAM_PARTICLES_DISTANCE)
    KRATOS_REGISTER_VARIABLE(BEAM_LENGTH)
    KRATOS_REGISTER_VARIABLE(I22) // Planar moment of inertia 22
    KRATOS_REGISTER_VARIABLE(I33) // Planar moment of inertia 33
    KRATOS_REGISTER_VARIABLE(BEAM_INERTIA_ROT_UNIT_LENGHT_X) // Moment of inertia X / (mass * beam length)
    KRATOS_REGISTER_VARIABLE(BEAM_INERTIA_ROT_UNIT_LENGHT_Y) // Moment of inertia Y / (mass * beam length)
    KRATOS_REGISTER_VARIABLE(BEAM_INERTIA_ROT_UNIT_LENGHT_Z) // Moment of inertia Z / (mass * beam length)
    // **********  Beam related variables END  **********

    // MATERIAL PARAMETERS
    KRATOS_REGISTER_VARIABLE(WALL_POINT_CONDITION_POINTERS)
    KRATOS_REGISTER_VARIABLE(WALL_POINT_CONDITION_ELASTIC_FORCES)
    KRATOS_REGISTER_VARIABLE(WALL_POINT_CONDITION_TOTAL_FORCES)
    KRATOS_REGISTER_VARIABLE(VECTOR_OF_PROPERTIES_PROXIES)
    KRATOS_REGISTER_VARIABLE(NODAL_MASS_COEFF)
    KRATOS_REGISTER_VARIABLE(PARTICLE_MOMENT_OF_INERTIA)
    KRATOS_REGISTER_VARIABLE(ROLLING_FRICTION)
    KRATOS_REGISTER_VARIABLE(ROLLING_FRICTION_WITH_WALLS)
    KRATOS_REGISTER_VARIABLE(HISTORICAL_MIN_K)
    KRATOS_REGISTER_VARIABLE(PARTICLE_INERTIA)
    KRATOS_REGISTER_VARIABLE(PARTICLE_DENSITY)
    KRATOS_REGISTER_VARIABLE(FRICTION) //deprecated since April 6th, 2020
    KRATOS_REGISTER_VARIABLE(STATIC_FRICTION)
    KRATOS_REGISTER_VARIABLE(DYNAMIC_FRICTION)
    KRATOS_REGISTER_VARIABLE(FRICTION_DECAY)
    KRATOS_REGISTER_VARIABLE(COEFFICIENT_OF_RESTITUTION)
    KRATOS_REGISTER_VARIABLE(PARTICLE_ROTATION_DAMP_RATIO)
    KRATOS_REGISTER_VARIABLE(DAMPING_GAMMA)
    KRATOS_REGISTER_VARIABLE(K_NORMAL)
    KRATOS_REGISTER_VARIABLE(K_TANGENTIAL)
    KRATOS_REGISTER_VARIABLE(CONICAL_DAMAGE_CONTACT_RADIUS)
    KRATOS_REGISTER_VARIABLE(CONICAL_DAMAGE_MAX_STRESS)
    KRATOS_REGISTER_VARIABLE(CONICAL_DAMAGE_ALPHA)
    KRATOS_REGISTER_VARIABLE(CONICAL_DAMAGE_ALPHA_FUNCTION)
    KRATOS_REGISTER_VARIABLE(CONICAL_DAMAGE_GAMMA)
    KRATOS_REGISTER_VARIABLE(LEVEL_OF_FOULING)
    KRATOS_REGISTER_VARIABLE(EXCENTRICITY)
    KRATOS_REGISTER_VARIABLE(EXCENTRICITY_STANDARD_DEVIATION)
    KRATOS_REGISTER_VARIABLE(ROTATIONAL_MOMENT_COEFFICIENT)
    KRATOS_REGISTER_VARIABLE(POISSON_VALUE)
    KRATOS_REGISTER_VARIABLE(INTERNAL_COHESION)
    KRATOS_REGISTER_VARIABLE(K_ALPHA)

    // *************** Continuum only BEGIN *************
    KRATOS_REGISTER_VARIABLE(SLOPE_FRACTION_N1)
    KRATOS_REGISTER_VARIABLE(SLOPE_FRACTION_N2)
    KRATOS_REGISTER_VARIABLE(SLOPE_FRACTION_N3)
    KRATOS_REGISTER_VARIABLE(SLOPE_LIMIT_COEFF_C1)
    KRATOS_REGISTER_VARIABLE(SLOPE_LIMIT_COEFF_C2)
    KRATOS_REGISTER_VARIABLE(SLOPE_LIMIT_COEFF_C3)
    KRATOS_REGISTER_VARIABLE(YOUNG_MODULUS_PLASTIC)
    KRATOS_REGISTER_VARIABLE(PLASTIC_YIELD_STRESS)
    KRATOS_REGISTER_VARIABLE(DAMAGE_FACTOR)
    KRATOS_REGISTER_VARIABLE(SHEAR_ENERGY_COEF)
    KRATOS_REGISTER_VARIABLE(DONZE_G1)
    KRATOS_REGISTER_VARIABLE(DONZE_G2)
    KRATOS_REGISTER_VARIABLE(DONZE_G3)
    KRATOS_REGISTER_VARIABLE(DONZE_MAX_DEF)
    KRATOS_REGISTER_VARIABLE(CONTACT_FAILURE)
    KRATOS_REGISTER_VARIABLE(CONTACT_ORIENTATION)
    KRATOS_REGISTER_VARIABLE(CONTACT_SIGMA)
    KRATOS_REGISTER_VARIABLE(CONTACT_TAU)
    KRATOS_REGISTER_VARIABLE(FAILURE_CRITERION_STATE)
    KRATOS_REGISTER_VARIABLE(UNIDIMENSIONAL_DAMAGE)
    KRATOS_REGISTER_VARIABLE(CONTACT_SIGMA_MIN)
    KRATOS_REGISTER_VARIABLE(TENSION_LIMIT_INCREASE_SLOPE)
    KRATOS_REGISTER_VARIABLE(CONTACT_TAU_ZERO)
    KRATOS_REGISTER_VARIABLE(CONTACT_INTERNAL_FRICC)
    KRATOS_REGISTER_VARIABLE(KDEM_STANDARD_DEVIATION_TAU_ZERO)
    KRATOS_REGISTER_VARIABLE(KDEM_STANDARD_DEVIATION_FRICTION)
    KRATOS_REGISTER_VARIABLE(PERTURBED_TAU_ZERO)
    KRATOS_REGISTER_VARIABLE(PERTURBED_INTERNAL_FRICTION)
    KRATOS_REGISTER_VARIABLE(SIGMA_3_AVERAGE)
    KRATOS_REGISTER_VARIABLE(LOOSE_MATERIAL_YOUNG_MODULUS)
    KRATOS_REGISTER_VARIABLE(BONDED_MATERIAL_YOUNG_MODULUS)
    KRATOS_REGISTER_VARIABLE(DEBUG_PRINTING_OPTION)
    KRATOS_REGISTER_VARIABLE(DEBUG_PRINTING_ID_1)
    KRATOS_REGISTER_VARIABLE(DEBUG_PRINTING_ID_2)
    KRATOS_REGISTER_VARIABLE(FRACTURE_ENERGY)
    KRATOS_REGISTER_VARIABLE(FRACTURE_ENERGY_NORMAL)
    KRATOS_REGISTER_VARIABLE(FRACTURE_ENERGY_TANGENTIAL)
    KRATOS_REGISTER_VARIABLE(FRACTURE_ENERGY_EXPONENT)
    KRATOS_REGISTER_VARIABLE(SIGMA_SLOPE_CHANGE_THRESHOLD)
    KRATOS_REGISTER_VARIABLE(INTERNAL_FRICTION_AFTER_THRESHOLD)
    KRATOS_REGISTER_VARIABLE(SEARCH_RADIUS_INCREMENT_FOR_BONDS_CREATION)
    KRATOS_REGISTER_VARIABLE(IS_UNBREAKABLE)
    KRATOS_REGISTER_VARIABLE(STIFFNESS_FACTOR)
    KRATOS_REGISTER_VARIABLE(BOND_YOUNG_MODULUS)
    KRATOS_REGISTER_VARIABLE(BOND_KNKS_RATIO)
    KRATOS_REGISTER_VARIABLE(BOND_SIGMA_MAX)
    KRATOS_REGISTER_VARIABLE(BOND_SIGMA_MAX_DEVIATION)
    KRATOS_REGISTER_VARIABLE(BOND_TAU_ZERO)
    KRATOS_REGISTER_VARIABLE(BOND_TAU_ZERO_DEVIATION)
    KRATOS_REGISTER_VARIABLE(BOND_INTERNAL_FRICC)
    KRATOS_REGISTER_VARIABLE(BOND_ROTATIONAL_MOMENT_COEFFICIENT_NORMAL)
    KRATOS_REGISTER_VARIABLE(BOND_ROTATIONAL_MOMENT_COEFFICIENT_TANGENTIAL)
    KRATOS_REGISTER_VARIABLE(BOND_RADIUS_FACTOR)
    KRATOS_REGISTER_VARIABLE(JOINT_NORMAL_STIFFNESS)
    KRATOS_REGISTER_VARIABLE(JOINT_TANGENTIAL_STIFFNESS)
    KRATOS_REGISTER_VARIABLE(JOINT_NORMAL_DIRECTION_X)
    KRATOS_REGISTER_VARIABLE(JOINT_NORMAL_DIRECTION_Y)
    KRATOS_REGISTER_VARIABLE(JOINT_NORMAL_DIRECTION_Z)
    KRATOS_REGISTER_VARIABLE(JOINT_FRICTION_COEFF)
    // *************** Continuum only END *************

    // GEOMETRIC PARAMETERS

    // *************** Continuum only BEGIN *************
    KRATOS_REGISTER_VARIABLE(LOCAL_CONTACT_AREA_HIGH)
    KRATOS_REGISTER_VARIABLE(LOCAL_CONTACT_AREA_LOW)
    KRATOS_REGISTER_VARIABLE(MEAN_CONTACT_AREA)
    KRATOS_REGISTER_VARIABLE(CONTACT_RADIUS)
    KRATOS_REGISTER_VARIABLE(REPRESENTATIVE_VOLUME)
    KRATOS_REGISTER_VARIABLE(NEIGHBOUR_IDS)
    KRATOS_REGISTER_VARIABLE(NEIGHBOURS_CONTACT_AREAS)
    KRATOS_REGISTER_VARIABLE(NEIGHBOUR_SIZE)
    KRATOS_REGISTER_VARIABLE(DAMAGE_RATIO)
    // *************** Continuum only END ***************

    // INLET PARAMETERS
    KRATOS_REGISTER_VARIABLE(INLET_START_TIME)
    KRATOS_REGISTER_VARIABLE(INLET_STOP_TIME)
    KRATOS_REGISTER_VARIABLE(INLET_NUMBER_OF_PARTICLES)
    KRATOS_REGISTER_VARIABLE(STANDARD_DEVIATION)
    KRATOS_REGISTER_VARIABLE(DEVIATION)
    KRATOS_REGISTER_VARIABLE(MAX_RAND_DEVIATION_ANGLE)
    KRATOS_REGISTER_VARIABLE(IMPOSED_MASS_FLOW_OPTION)
    KRATOS_REGISTER_VARIABLE(MASS_FLOW)
    KRATOS_REGISTER_VARIABLE(MAXIMUM_RADIUS)
    KRATOS_REGISTER_VARIABLE(MINIMUM_RADIUS)
    KRATOS_REGISTER_VARIABLE(INITIAL_RADIUS)
    KRATOS_REGISTER_VARIABLE(DENSE_INLET)
    KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(LINEAR_VELOCITY)
    KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(INLET_INITIAL_VELOCITY)
    KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(INLET_INITIAL_PARTICLES_VELOCITY)
    KRATOS_REGISTER_VARIABLE(INLET_MAX_PARTICLES_VELOCITY)

    // KINEMATICS
    KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(PARTICLE_ROTATION_ANGLE)
    KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(EULER_ANGLES)
    KRATOS_REGISTER_VARIABLE(DOMAIN_IS_PERIODIC)
    KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(DOMAIN_MIN_CORNER)
    KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(DOMAIN_MAX_CORNER)
    KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(DELTA_DISPLACEMENT)
    KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(DELTA_ROTA_DISPLACEMENT)
    KRATOS_REGISTER_VARIABLE(VELOCITY_START_TIME)
    KRATOS_REGISTER_VARIABLE(VELOCITY_STOP_TIME)
    KRATOS_REGISTER_VARIABLE(ANGULAR_VELOCITY_START_TIME)
    KRATOS_REGISTER_VARIABLE(ANGULAR_VELOCITY_STOP_TIME)
    KRATOS_REGISTER_VARIABLE(RIGID_BODY_MOTION)
    KRATOS_REGISTER_VARIABLE(FREE_BODY_MOTION)
    KRATOS_REGISTER_VARIABLE(RIGID_BODY_OPTION)
    KRATOS_REGISTER_VARIABLE(RIGID_BODY_MASS)
    KRATOS_REGISTER_VARIABLE(RIGID_BODY_CENTER_OF_MASS)
    KRATOS_REGISTER_VARIABLE(RIGID_BODY_INERTIAS)

    // ****************** Quaternion Integration BEGIN ******************
    KRATOS_REGISTER_VARIABLE(AUX_ORIENTATION)
    KRATOS_REGISTER_VARIABLE(LOCAL_AUX_ANGULAR_VELOCITY)
    // ******************* Quaternion Integration END *******************

    // ****************Radius expansion method BEGIN*******************
    KRATOS_REGISTER_VARIABLE(IS_RADIUS_EXPANSION)
    KRATOS_REGISTER_VARIABLE(RADIUS_EXPANSION_RATE)
    KRATOS_REGISTER_VARIABLE(RADIUS_MULTIPLIER_START_TIME)
    KRATOS_REGISTER_VARIABLE(RADIUS_MULTIPLIER_MAX)
    KRATOS_REGISTER_VARIABLE(IS_RADIUS_EXPANSION_RATE_CHANGE)
    KRATOS_REGISTER_VARIABLE(RADIUS_EXPANSION_ACCELERATION)
    KRATOS_REGISTER_VARIABLE(RADIUS_EXPANSION_RATE_MIN)
    // *****************Radius expansion method END********************

    // FORCE AND MOMENTUM
    KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(CONTACT_IMPULSE)
    KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(PARTICLE_MOMENT)
    KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(ROLLING_RESISTANCE_MOMENT)
    KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(MAX_ROTA_MOMENT)
    KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(ELASTIC_FORCES)
    KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(CONTACT_FORCES)
    KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(RIGID_ELEMENT_FORCE)
    KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(TANGENTIAL_ELASTIC_FORCES)
    KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(FORCE_REACTION)
    KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(MOMENT_REACTION)
    KRATOS_REGISTER_VARIABLE(DEM_PRESSURE)
    KRATOS_REGISTER_VARIABLE(DEM_NODAL_AREA)

    // ENERGY
    KRATOS_REGISTER_VARIABLE(PARTICLE_ELASTIC_ENERGY)
    KRATOS_REGISTER_VARIABLE(PARTICLE_TRANSLATIONAL_KINEMATIC_ENERGY)
    KRATOS_REGISTER_VARIABLE(PARTICLE_ROTATIONAL_KINEMATIC_ENERGY)
    KRATOS_REGISTER_VARIABLE(PARTICLE_GRAVITATIONAL_ENERGY)
    KRATOS_REGISTER_VARIABLE(PARTICLE_INELASTIC_VISCODAMPING_ENERGY)
    KRATOS_REGISTER_VARIABLE(PARTICLE_INELASTIC_FRICTIONAL_ENERGY)
    KRATOS_REGISTER_VARIABLE(PARTICLE_INELASTIC_ROLLING_RESISTANCE_ENERGY)
    KRATOS_REGISTER_VARIABLE(PARTICLE_MAX_NORMAL_BALL_TO_BALL_FORCE_TIMES_RADIUS)
    KRATOS_REGISTER_VARIABLE(COMPUTE_ENERGY_OPTION)
    KRATOS_REGISTER_VARIABLE(GLOBAL_DAMPING)
    KRATOS_REGISTER_VARIABLE(NORMAL_IMPACT_VELOCITY)
    KRATOS_REGISTER_VARIABLE(TANGENTIAL_IMPACT_VELOCITY)
    KRATOS_REGISTER_VARIABLE(FACE_NORMAL_IMPACT_VELOCITY)
    KRATOS_REGISTER_VARIABLE(FACE_TANGENTIAL_IMPACT_VELOCITY)
    KRATOS_REGISTER_VARIABLE(LINEAR_IMPULSE)

    // *************** Continuum only BEGIN *************
    KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(INITIAL_ROTA_MOMENT)
    KRATOS_REGISTER_VARIABLE(PARTICLE_BLOCK_CONTACT_FORCE)
    KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(LOCAL_CONTACT_FORCE)
    KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(GLOBAL_CONTACT_FORCE)
    KRATOS_REGISTER_VARIABLE(PARTICLE_CONTACT_FORCES)

    // CONCRETE TEST
    KRATOS_REGISTER_VARIABLE(FIXED_VEL_TOP)
    KRATOS_REGISTER_VARIABLE(FIXED_VEL_BOT)
    KRATOS_REGISTER_VARIABLE(AREA_VERTICAL_TAPA)
    KRATOS_REGISTER_VARIABLE(AREA_VERTICAL_CENTRE)

    // TENSION
    KRATOS_REGISTER_VARIABLE(DEM_STRESS_TENSOR)
    KRATOS_REGISTER_VARIABLE(DEM_STRESS_TENSOR_RAW)
    KRATOS_REGISTER_VARIABLE(DEM_STRAIN_TENSOR)
    KRATOS_REGISTER_VARIABLE(DEM_DIFFERENTIAL_STRAIN_TENSOR)

    // APPLIED LOADS
    KRATOS_REGISTER_VARIABLE(BLAST_RADIUS)
    KRATOS_REGISTER_VARIABLE(BLAST_CURVE)
    KRATOS_REGISTER_VARIABLE(BLAST_PRESSURE_MAX)
    KRATOS_REGISTER_VARIABLE(BLAST_TIME_PRESSURE_MAX)
    KRATOS_REGISTER_VARIABLE(BLAST_SHAPE_FACTOR)
    KRATOS_REGISTER_VARIABLE(BLAST_TIME_DELAY)
    KRATOS_REGISTER_VARIABLE(BLAST_BOREHOLE)
    KRATOS_REGISTER_VARIABLE(BLAST_NPOINTS)
    KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(BLAST_COORDINATES_1)
    KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(BLAST_COORDINATES_2)
    KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(BLAST_COORDINATES_3)
    KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(BLAST_COORDINATES_4)
    KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(BLAST_COORDINATES_5)
    KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(BLAST_COORDINATES_6)
    KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(BLAST_COORDINATES_7)
    KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(BLAST_COORDINATES_8)
    // *************** Continuum only END *************

    // Possible future blocks (no FEM) interaction
    KRATOS_REGISTER_VARIABLE(PARTICLE_BLOCK_CONTACT_FAILURE_ID)
    KRATOS_REGISTER_VARIABLE(PARTICLE_BLOCK_IF_INITIAL_CONTACT)
    KRATOS_REGISTER_VARIABLE(NEIGHBOUR_PARTICLE_BLOCK_ELEMENTS)
    KRATOS_REGISTER_VARIABLE(NEIGHBOUR_RIGID_FACES)
    KRATOS_REGISTER_VARIABLE(NEIGHBOUR_RIGID_FACES_PRAM)
    KRATOS_REGISTER_VARIABLE(NEIGHBOUR_PARTICLE_OF_RIGID_FACE)
    KRATOS_REGISTER_VARIABLE(NEIGHBOUR_RIGID_FACES_ELASTIC_CONTACT_FORCE)
    KRATOS_REGISTER_VARIABLE(NEIGHBOUR_RIGID_FACES_TOTAL_CONTACT_FORCE)

    // DUMMIES INT AND DOUBLE VARIABLES
    KRATOS_REGISTER_VARIABLE(DUMMY_SWITCH)

    //EXPORTS
    KRATOS_REGISTER_VARIABLE(EXPORT_ID)
    KRATOS_REGISTER_VARIABLE(PRINT_EXPORT_ID)
    KRATOS_REGISTER_VARIABLE(PRINT_STRESS_TENSOR_OPTION)

    //For DEM_FEM Element
    KRATOS_REGISTER_VARIABLE(LOCAL_DAMP_RATIO)

    //For DEM_FEM Condition
    //    KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS( FORCE_RESIDUAL )
    //    KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS( EXTERNAL_FORCE )

    // DUMMY VARIABLES FOR CALCULATE
    KRATOS_REGISTER_VARIABLE(CALCULATE_COMPUTE_NEW_NEIGHBOURS_HISTORICAL_DATA)
    KRATOS_REGISTER_VARIABLE(CALCULATE_COMPUTE_NEW_RIGID_FACE_NEIGHBOURS_HISTORICAL_DATA)
    KRATOS_REGISTER_VARIABLE(CALCULATE_SET_INITIAL_DEM_CONTACTS)
    KRATOS_REGISTER_VARIABLE(CALCULATE_SET_INITIAL_FEM_CONTACTS)
    KRATOS_REGISTER_VARIABLE(RIGID_FACE_ROTA_SPEED)
    KRATOS_REGISTER_VARIABLE(RIGID_FACE_AXIAL_SPEED)
    KRATOS_REGISTER_VARIABLE(RIGID_FACE_PROP_ID)
    KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(RIGID_FACE_ROTA_ORIGIN_COORD)
    KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(RIGID_FACE_ROTA_AXIAL_DIR)
    KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(RIGID_FACE_ROTA_GLOBAL_VELOCITY)
    KRATOS_REGISTER_VARIABLE(RIGID_FACE_BEGIN_TIME)
    KRATOS_REGISTER_VARIABLE(RIGID_FACE_END_TIME)
    KRATOS_REGISTER_VARIABLE(RIGID_FACE_FLAG)
    KRATOS_REGISTER_VARIABLE(RIGID_FACE_COMPUTE_MOVEMENT)

    //SLS DEM-FEM
    KRATOS_REGISTER_VARIABLE(SHEAR_STRESS)
    KRATOS_REGISTER_VARIABLE(NON_DIMENSIONAL_VOLUME_WEAR)
    KRATOS_REGISTER_VARIABLE(IMPACT_WEAR)
    KRATOS_REGISTER_VARIABLE(SEVERITY_OF_WEAR)
    KRATOS_REGISTER_VARIABLE(BRINELL_HARDNESS)
    KRATOS_REGISTER_VARIABLE(COMPUTE_WEAR)
    KRATOS_REGISTER_VARIABLE(IMPACT_WEAR_SEVERITY)
    KRATOS_REGISTER_VARIABLE(WALL_COHESION) //TODO: remove this variable
    
    //DEM_CLUSTERS
    KRATOS_REGISTER_VARIABLE(CLUSTER_VOLUME)
    KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(PRINCIPAL_MOMENTS_OF_INERTIA)
    KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(LOCAL_ANGULAR_VELOCITY)
    KRATOS_REGISTER_VARIABLE(CHARACTERISTIC_LENGTH)
    KRATOS_REGISTER_VARIABLE(SPRAYED_MATERIAL)

    //BOUNDING BOX
    KRATOS_REGISTER_VARIABLE(BOUNDING_BOX_START_TIME)
    KRATOS_REGISTER_VARIABLE(BOUNDING_BOX_STOP_TIME)

    //FOR RECAREY FORMULAE
    KRATOS_REGISTER_VARIABLE(TOTAL_CONTACT_DISTANCES)

    //CONTROL MODULE
    KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(TARGET_STRESS)
    KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(REACTION_STRESS)
    KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(SMOOTHED_REACTION_STRESS)
    KRATOS_REGISTER_3D_VARIABLE_WITH_COMPONENTS(LOADING_VELOCITY)
    KRATOS_REGISTER_VARIABLE(RADIAL_NORMAL_STRESS_COMPONENT)
    KRATOS_REGISTER_VARIABLE(OLD_RADIAL_NORMAL_STRESS_COMPONENT)
    KRATOS_REGISTER_VARIABLE(SMOOTHED_SCALAR_RADIAL_VELOCITY)

    // for DEM-FEM 2D
    KRATOS_REGISTER_VARIABLE(IMPOSED_Z_STRAIN_VALUE)
    KRATOS_REGISTER_VARIABLE(IMPOSED_Z_STRAIN_OPTION)

    // RVE analysis
    KRATOS_REGISTER_VARIABLE(RVE_ANALYSIS)
    
    // ELEMENTS
    KRATOS_REGISTER_ELEMENT("CylinderParticle2D", mCylinderParticle2D)
    KRATOS_REGISTER_ELEMENT("CylinderContinuumParticle2D", mCylinderContinuumParticle2D)
    KRATOS_REGISTER_ELEMENT("SphericParticle3D", mSphericParticle3D)
    KRATOS_REGISTER_ELEMENT("NanoParticle3D", mNanoParticle3D)
    KRATOS_REGISTER_ELEMENT("AnalyticSphericParticle3D", mAnalyticSphericParticle3D)
    KRATOS_REGISTER_ELEMENT("SphericContinuumParticle3D", mSphericContinuumParticle3D)
    KRATOS_REGISTER_ELEMENT("PolyhedronSkinSphericParticle3D", mPolyhedronSkinSphericParticle3D)
    KRATOS_REGISTER_ELEMENT("IceContinuumParticle3D", mIceContinuumParticle3D)
    KRATOS_REGISTER_ELEMENT("BeamParticle3D", mBeamParticle3D)
    KRATOS_REGISTER_ELEMENT("BondingSphericContinuumParticle3D", mBondingSphericContinuumParticle3D)
    KRATOS_REGISTER_ELEMENT("ParticleContactElement", mParticleContactElement)
    KRATOS_REGISTER_ELEMENT("RigidBodyElement3D", mRigidBodyElement3D)
    KRATOS_REGISTER_ELEMENT("ShipElement3D", mShipElement3D)
    KRATOS_REGISTER_ELEMENT("ContactInfoSphericParticle3D", mContactInfoSphericParticle3D)
    KRATOS_REGISTER_ELEMENT("Cluster3D", mCluster3D)
    KRATOS_REGISTER_ELEMENT("SingleSphereCluster3D", mSingleSphereCluster3D)

    KRATOS_REGISTER_CONDITION("MAPcond", mMapCon3D3N)
    KRATOS_REGISTER_CONDITION("SolidFace3D", mSolidFace3D3N)
    KRATOS_REGISTER_CONDITION("SolidFace3D3N", mSolidFace3D3N)
    KRATOS_REGISTER_CONDITION("SolidFace3D4N", mSolidFace3D4N)
    KRATOS_REGISTER_CONDITION("RigidFace3D", mRigidFace3D3N)
    KRATOS_REGISTER_CONDITION("RigidFace3D2N", mRigidFace3D2N)
    KRATOS_REGISTER_CONDITION("RigidFace3D3N", mRigidFace3D3N)
    KRATOS_REGISTER_CONDITION("RigidFace3D4N", mRigidFace3D4N)
    KRATOS_REGISTER_CONDITION("RigidFace3D1N", mRigidFace3D1N)
    KRATOS_REGISTER_CONDITION("AnalyticRigidFace3D", mAnalyticRigidFace3D3N)
    KRATOS_REGISTER_CONDITION("AnalyticRigidFace3D3N", mAnalyticRigidFace3D3N)
    KRATOS_REGISTER_CONDITION("RigidEdge2D2N", mRigidEdge2D2N)
    KRATOS_REGISTER_CONDITION("RigidEdge2D1N", mRigidEdge2D1N)

    // SERIALIZER
    Serializer::Register("PropertiesProxy", PropertiesProxy());
    Serializer::Register("DEM_D_Linear_Simple_Coulomb", DEM_D_Linear_Simple_Coulomb());
    Serializer::Register("DEM_D_Linear_viscous_Coulomb", DEM_D_Linear_viscous_Coulomb());
    Serializer::Register("DEM_D_Linear_viscous_Coulomb2D", DEM_D_Linear_viscous_Coulomb2D());
    Serializer::Register("DEM_D_Hertz_viscous_Coulomb", DEM_D_Hertz_viscous_Coulomb());
    Serializer::Register("DEM_D_Hertz_viscous_Coulomb2D", DEM_D_Hertz_viscous_Coulomb2D());
    Serializer::Register("DEM_D_JKR_Cohesive_Law", DEM_D_JKR_Cohesive_Law());
    Serializer::Register("DEM_D_Bentonite_Colloid", DEM_D_Bentonite_Colloid());
    Serializer::Register("DEM_D_DMT_Cohesive_Law", DEM_D_DMT_Cohesive_Law());
    Serializer::Register("DEM_D_Stress_Dependent_Cohesive", DEM_D_Stress_Dependent_Cohesive());
    Serializer::Register("DEM_D_Linear_Custom_Constants", DEM_D_Linear_Custom_Constants());
    Serializer::Register("DEM_D_Conical_damage", DEM_D_Conical_damage());
    Serializer::Register("DEM_D_Hertz_viscous_Coulomb_Nestle", DEM_D_Hertz_viscous_Coulomb_Nestle());
    Serializer::Register("DEM_D_Quadratic", DEM_D_Quadratic());
    Serializer::Register("DEM_D_Linear_classic", DEM_D_Linear_classic());
    Serializer::Register("DEM_D_void", DEM_D_void());
    Serializer::Register("DEM_Dempack", DEM_Dempack());
    Serializer::Register("DEM_Dempack2D", DEM_Dempack2D());
    Serializer::Register("DEM_KDEM", DEM_KDEM());
    Serializer::Register("DEM_KDEMFabric", DEM_KDEMFabric());
    Serializer::Register("DEMBeamConstitutiveLaw", DEMBeamConstitutiveLaw());
    Serializer::Register("DEM_KDEM_Rankine", DEM_KDEM_Rankine());
    Serializer::Register("DEM_KDEM_CamClay", DEM_KDEM_CamClay());
    Serializer::Register("DEM_Dempack_torque", DEM_Dempack_torque());
    Serializer::Register("DEM_Dempack_dev", DEM_Dempack_dev());
    Serializer::Register("DEM_KDEM2D", DEM_KDEM2D());
    Serializer::Register("DEM_ExponentialHC", DEM_ExponentialHC());
    Serializer::Register("DEM_parallel_bond", DEM_parallel_bond());
    Serializer::Register("DEM_smooth_joint", DEM_smooth_joint());
    Serializer::Register("DEM_parallel_bond_for_membrane", DEM_parallel_bond_for_membrane());
    Serializer::Register("DEM_parallel_bond_bilinear_damage", DEM_parallel_bond_bilinear_damage());
    Serializer::Register("DEM_parallel_bond_bilinear_damage_mixed", DEM_parallel_bond_bilinear_damage_mixed());
    Serializer::Register("DEMRollingFrictionModelConstantTorque", DEMRollingFrictionModelConstantTorque());
    Serializer::Register("DEMRollingFrictionModelViscousTorque", DEMRollingFrictionModelViscousTorque());
    Serializer::Register("DEMRollingFrictionModelBounded", DEMRollingFrictionModelBounded());
    Serializer::Register("DEMGlobalDampingNonViscousCstForceDir", DEMGlobalDampingNonViscousCstForceDir());
    Serializer::Register("DEMGlobalDampingNonViscousVarForceDir", DEMGlobalDampingNonViscousVarForceDir());
    Serializer::Register("DEMGlobalDampingViscous", DEMGlobalDampingViscous());
    Serializer::Register("ForwardEulerScheme", ForwardEulerScheme());
    Serializer::Register("SymplecticEulerScheme", SymplecticEulerScheme());
    Serializer::Register("TaylorScheme", TaylorScheme());
    Serializer::Register("VelocityVerletScheme", VelocityVerletScheme());
    Serializer::Register("RungeKuttaScheme", RungeKuttaScheme());
    Serializer::Register("QuaternionIntegrationScheme", QuaternionIntegrationScheme());
    Serializer::Register("DEMIntegrationScheme", DEMIntegrationScheme());

    KRATOS_INFO("") << " done." << std::endl;
}
}  // namespace Kratos.
